package com.itheima.zuoye.zy4;

import java.util.Scanner;

public class RegularExpression {
    public static void main(String[] args) {
//        输入电话检查是否合法
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入手机号码: ");
        String phone = scanner.nextLine();
        boolean b = phone.matches("1[3-9]\\d{8}");
        System.out.println(b ? "合法" : "不合法");

        System.out.print("请输入邮箱: ");
        String email = scanner.nextLine();
        boolean b1 = email.matches("\\w+@\\w+\\.\\w+");
        System.out.println(b1 ? "合法" : "不合法");

        System.out.print("请输入时间: ");
        String time = scanner.nextLine();
        boolean b2 = time.matches("\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}");
        System.out.println(b2 ? "合法" : "不合法");

    }

}
